home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 47.7z / BS1 part 47 / Soundtracker v2.3 (1989)(Spreadpoint - CCS - Defjam).7z / Soundtracker v2.3 (1989)(Spreadpoint - CCS - Defjam).adf / Text / Replay.s next >
Text File  |  1989-04-25  |  7KB  |  413 lines

  1. ; -----------------------------------------------------
  2. ; ------- D.O.C Soundtracker V2.3 - playroutine -------
  3. ; -----------------------------------------------------
  4. ; ---- Improved and optimized by  Unknown of D.O.C ----
  5. ; --------- Based on the playroutine from TJC ---------
  6. ; -----------------------------------------------------
  7.  
  8. mt_init:lea    mt_data,a0
  9.     add.l    #$03b8,a0
  10.     moveq    #$7f,d0
  11.     moveq    #0,d1
  12. mt_init1:
  13.     move.l    d1,d2
  14.     subq.w    #1,d0
  15. mt_init2:
  16.     move.b    (a0)+,d1
  17.     cmp.b    d2,d1
  18.     bgt.s    mt_init1
  19.     dbf    d0,mt_init2
  20.     addq.b    #1,d2
  21.  
  22. mt_init3:
  23.     lea    mt_data,a0
  24.     lea    mt_sample1(pc),a1
  25.     asl.l    #8,d2
  26.     asl.l    #2,d2
  27.     add.l    #$438,d2
  28.     add.l    a0,d2
  29.     moveq    #$1e,d0
  30. mt_init4:
  31.     move.l    d2,(a1)+
  32.     moveq    #0,d1
  33.     move.w    42(a0),d1
  34.     asl.l    #1,d1
  35.     add.l    d1,d2
  36.     add.l    #$1e,a0
  37.     dbf    d0,mt_init4
  38.  
  39.     lea    mt_sample1(PC),a0
  40.     moveq    #0,d0
  41. mt_clear:
  42.     move.l    (a0,d0.w),a1
  43.     clr.l    (a1)
  44.     addq.w    #4,d0
  45.     cmp.w    #$7c,d0
  46.     bne.s    mt_clear
  47.  
  48.     clr.w    $dff0a8
  49.     clr.w    $dff0b8
  50.     clr.w    $dff0c8
  51.     clr.w    $dff0d8
  52.     clr.l    mt_partnrplay
  53.     clr.l    mt_partnote
  54.     clr.l    mt_partpoint
  55.  
  56.     move.b    mt_data+$3b6,mt_maxpart+1
  57.     rts
  58.  
  59. mt_end:    clr.w    $dff0a8
  60.     clr.w    $dff0b8
  61.     clr.w    $dff0c8
  62.     clr.w    $dff0d8
  63.     move.w    #$f,$dff096
  64.     rts
  65.  
  66. mt_music:
  67.     addq.w    #1,mt_counter
  68. mt_cool:cmp.w    #6,mt_counter
  69.     bne.s    mt_notsix
  70.     clr.w    mt_counter
  71.     bra    mt_rout2
  72.  
  73. mt_notsix:
  74.     lea    mt_aud1temp(PC),a6
  75.     tst.b    3(a6)
  76.     beq.s    mt_arp1
  77.     lea    $dff0a0,a5        
  78.     bsr.s    mt_arprout
  79. mt_arp1:lea    mt_aud2temp(PC),a6
  80.     tst.b    3(a6)
  81.     beq.s    mt_arp2
  82.     lea    $dff0b0,a5
  83.     bsr.s    mt_arprout
  84. mt_arp2:lea    mt_aud3temp(PC),a6
  85.     tst.b    3(a6)
  86.     beq.s    mt_arp3
  87.     lea    $dff0c0,a5
  88.     bsr.s    mt_arprout
  89. mt_arp3:lea    mt_aud4temp(PC),a6
  90.     tst.b    3(a6)
  91.     beq.s    mt_arp4
  92.     lea    $dff0d0,a5
  93.     bra.s    mt_arprout
  94. mt_arp4:rts
  95.  
  96. mt_arprout:
  97.     move.b    2(a6),d0
  98.     and.b    #$0f,d0
  99.     tst.b    d0
  100.     beq    mt_arpegrt
  101.     cmp.b    #$01,d0
  102.     beq.s    mt_portup
  103.     cmp.b    #$02,d0
  104.     beq.s    mt_portdwn
  105.     cmp.b    #$0a,d0
  106.     beq.s    mt_volslide
  107.     rts
  108.  
  109. mt_portup:
  110.     moveq    #0,d0
  111.     move.b    3(a6),d0
  112.     sub.w    d0,22(a6)
  113.     cmp.w    #$71,22(a6)
  114.     bpl.s    mt_ok1
  115.     move.w    #$71,22(a6)
  116. mt_ok1:    move.w    22(a6),6(a5)
  117.     rts
  118.  
  119. mt_portdwn:
  120.     moveq    #0,d0
  121.     move.b    3(a6),d0
  122.     add.w    d0,22(a6)
  123.     cmp.w    #$538,22(a6)
  124.     bmi.s    mt_ok2
  125.     move.w    #$538,22(a6)
  126. mt_ok2:    move.w    22(a6),6(a5)
  127.     rts
  128.  
  129. mt_volslide:
  130.     moveq    #0,d0
  131.     move.b    3(a6),d0
  132.     lsr.b    #4,d0
  133.     tst.b    d0
  134.     beq.s    mt_voldwn
  135.     add.w    d0,18(a6)
  136.     cmp.w    #64,18(a6)
  137.     bmi.s    mt_ok3
  138.     move.w    #64,18(a6)
  139. mt_ok3:    move.w    18(a6),8(a5)
  140.     rts
  141. mt_voldwn:
  142.     moveq    #0,d0
  143.     move.b    3(a6),d0
  144.     and.b    #$0f,d0
  145.     sub.w    d0,18(a6)
  146.     bpl.s    mt_ok4
  147.     clr.w    18(a6)
  148. mt_ok4:    move.w    18(a6),8(a5)
  149.     rts
  150.  
  151. mt_arpegrt:
  152.     move.w    mt_counter(PC),d0
  153.     cmp.w    #1,d0
  154.     beq.s    mt_loop2
  155.     cmp.w    #2,d0
  156.     beq.s    mt_loop3
  157.     cmp.w    #3,d0
  158.     beq.s    mt_loop4
  159.     cmp.w    #4,d0
  160.     beq.s    mt_loop2
  161.     cmp.w    #5,d0
  162.     beq.s    mt_loop3
  163.     rts
  164.  
  165. mt_loop2:
  166.     moveq    #0,d0
  167.     move.b    3(a6),d0
  168.     lsr.b    #4,d0
  169.     bra.s    mt_cont
  170. mt_loop3:
  171.     moveq    #$00,d0
  172.     move.b    3(a6),d0
  173.     and.b    #$0f,d0
  174.     bra.s    mt_cont
  175. mt_loop4:
  176.     move.w    16(a6),d2
  177.     bra.s    mt_endpart
  178. mt_cont:
  179.     add.w    d0,d0
  180.     moveq    #0,d1
  181.     move.w    16(a6),d1
  182.     lea    mt_arpeggio(PC),a0
  183. mt_loop5:
  184.     move.w    (a0,d0),d2
  185.     cmp.w    (a0),d1
  186.     beq.s    mt_endpart
  187.     addq.l    #2,a0
  188.     bra.s    mt_loop5
  189. mt_endpart:
  190.     move.w    d2,6(a5)
  191.     rts
  192.  
  193. mt_rout2:
  194.     lea    mt_data,a0
  195.     move.l    a0,a3
  196.     add.l    #$0c,a3
  197.     move.l    a0,a2
  198.     add.l    #$3b8,a2
  199.     add.l    #$43c,a0
  200.     move.l    mt_partnrplay(PC),d0
  201.     moveq    #0,d1
  202.     move.b    (a2,d0),d1
  203.     asl.l    #8,d1
  204.     asl.l    #2,d1
  205.     add.l    mt_partnote(PC),d1
  206.     move.l    d1,mt_partpoint
  207.     clr.w    mt_dmacon
  208.  
  209.     lea    $dff0a0,a5
  210.     lea    mt_aud1temp(PC),a6
  211.     bsr    mt_playit
  212.     lea    $dff0b0,a5
  213.     lea    mt_aud2temp(PC),a6
  214.     bsr    mt_playit
  215.     lea    $dff0c0,a5
  216.     lea    mt_aud3temp(PC),a6
  217.     bsr    mt_playit
  218.     lea    $dff0d0,a5
  219.     lea    mt_aud4temp(PC),a6
  220.     bsr    mt_playit
  221.     move.w    #$01f4,d0
  222. mt_rls:    dbf    d0,mt_rls
  223.  
  224.     move.w    #$8000,d0
  225.     or.w    mt_dmacon,d0
  226.     move.w    d0,$dff096
  227.  
  228.     lea    mt_aud4temp(PC),a6
  229.     cmp.w    #1,14(a6)
  230.     bne.s    mt_voice3
  231.     move.l    10(a6),$dff0d0
  232.     move.w    #1,$dff0d4
  233. mt_voice3:
  234.     lea    mt_aud3temp(PC),a6
  235.     cmp.w    #1,14(a6)
  236.     bne.s    mt_voice2
  237.     move.l    10(a6),$dff0c0
  238.     move.w    #1,$dff0c4
  239. mt_voice2:
  240.     lea    mt_aud2temp(PC),a6
  241.     cmp.w    #1,14(a6)
  242.     bne.s    mt_voice1
  243.     move.l    10(a6),$dff0b0
  244.     move.w    #1,$dff0b4
  245. mt_voice1:
  246.     lea    mt_aud1temp(PC),a6
  247.     cmp.w    #1,14(a6)
  248.     bne.s    mt_voice0
  249.     move.l    10(a6),$dff0a0
  250.     move.w    #1,$dff0a4
  251. mt_voice0:
  252.     move.l    mt_partnote(PC),d0
  253.     add.l    #$10,d0
  254.     move.l    d0,mt_partnote
  255.     cmp.l    #$400,d0
  256.     bne.s    mt_stop
  257. mt_higher:
  258.     clr.l    mt_partnote
  259.     addq.l    #1,mt_partnrplay
  260.     moveq    #0,d0
  261.     move.w    mt_maxpart(PC),d0
  262.     move.l    mt_partnrplay(PC),d1
  263.     cmp.l    d0,d1
  264.     bne.s    mt_stop
  265.     clr.l    mt_partnrplay
  266.     st    Pflag
  267. mt_stop:tst.w    mt_status
  268.     beq.s    mt_stop2
  269.     clr.w    mt_status
  270.     bra.s    mt_higher
  271. mt_stop2:
  272.     rts
  273.  
  274. mt_playit:
  275.     move.l    (a0,d1.l),(a6)
  276.     addq.l    #4,d1
  277.     moveq    #0,d2
  278.     move.b    2(a6),d2
  279.     and.b    #$f0,d2
  280.     lsr.b    #4,d2
  281.  
  282.     move.b    (a6),d0
  283.     and.b    #$f0,d0
  284.     or.b    d0,d2
  285.     tst.b    d2
  286.     beq.s    mt_nosamplechange
  287.  
  288.     moveq    #0,d3
  289.     lea    mt_samples(PC),a1
  290.     move.l    d2,d4
  291.     asl.l    #2,d2
  292.     mulu    #$1e,d4
  293.     move.l    (a1,d2),4(a6)
  294.     move.w    (a3,d4.l),8(a6)
  295.     move.w    2(a3,d4.l),18(a6)
  296.     move.w    4(a3,d4.l),d3
  297.     tst.w    d3
  298.     beq.s    mt_displace
  299.     move.l    4(a6),d2
  300.     add.l    d3,d2
  301.     move.l    d2,4(a6)
  302.     move.l    d2,10(a6)
  303.     move.w    6(a3,d4.l),8(a6)
  304.     move.w    6(a3,d4.l),14(a6)
  305.     move.w    18(a6),8(a5)
  306.     bra.s    mt_nosamplechange
  307.  
  308. mt_displace:
  309.     move.l    4(a6),d2
  310.     add.l    d3,d2
  311.     move.l    d2,10(a6)
  312.     move.w    6(a3,d4.l),14(a6)
  313.     move.w    18(a6),8(a5)
  314. mt_nosamplechange:
  315.     tst.w    (a6)
  316.     beq.s    mt_retrout
  317.     move.w    (a6),16(a6)
  318.     move.w    20(a6),$dff096
  319.     move.l    4(a6),(a5)
  320.     move.w    8(a6),4(a5)
  321.     move.w    (a6),6(a5)
  322.     move.w    20(a6),d0
  323.     or.w    d0,mt_dmacon
  324.  
  325. mt_retrout:
  326.     tst.w    (a6)
  327.     beq.s    mt_nonewper
  328.     move.w    (a6),22(a6)
  329.  
  330. mt_nonewper:
  331.     move.b    2(a6),d0
  332.     and.b    #$0f,d0
  333.     cmp.b    #$0b,d0
  334.     beq.s    mt_posjmp
  335.     cmp.b    #$0c,d0
  336.     beq.s    mt_setvol
  337.     cmp.b    #$0d,d0
  338.     beq.s    mt_break
  339.     cmp.b    #$0e,d0
  340.     beq.s    mt_setfil
  341.     cmp.b    #$0f,d0
  342.     beq.s    mt_setspeed
  343.     rts
  344.  
  345. mt_posjmp:
  346.     not.w    mt_status
  347.     moveq    #0,d0
  348.     move.b    3(a6),d0
  349.     subq.b    #1,d0
  350.     move.l    d0,mt_partnrplay
  351.     rts
  352.  
  353. mt_setvol:
  354.     move.b    3(a6),8(a5)
  355.     rts
  356.  
  357. mt_break:
  358.     not.w    mt_status
  359.     rts
  360.  
  361. mt_setfil:
  362.     moveq    #0,d0
  363.     move.b    3(a6),d0
  364.     and.b    #1,d0
  365.     rol.b    #1,d0
  366.     and.b    #$fd,$bfe001
  367.     or.b    d0,$bfe001
  368.     rts
  369.  
  370. mt_setspeed:
  371.     move.b    3(a6),d0
  372.     and.b    #$0f,d0
  373.     beq.s    mt_back
  374.     clr.w    mt_counter
  375.     move.b    d0,mt_cool+3
  376. mt_back:rts
  377.  
  378. mt_aud1temp:
  379.     blk.w    10,0
  380.     dc.w    1
  381.     blk.w    2,0
  382. mt_aud2temp:
  383.     blk.w    10,0
  384.     dc.w    2
  385.     blk.w    2,0
  386. mt_aud3temp:
  387.     blk.w    10,0
  388.     dc.w    4
  389.     blk.w    2,0
  390. mt_aud4temp:
  391.     blk.w    10,0
  392.     dc.w    8
  393.     blk.w    2,0
  394.  
  395. mt_partnote:    dc.l    0
  396. mt_partnrplay:    dc.l    0
  397. mt_counter:    dc.w    0
  398. mt_partpoint:    dc.l    0
  399. mt_samples:    dc.l    0
  400. mt_sample1:    blk.l    31,0
  401. mt_maxpart:    dc.w    0
  402. mt_dmacon:    dc.w    0
  403. mt_status:    dc.w    0
  404.  
  405. mt_arpeggio:
  406.     dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c
  407.     dc.w $023a,$021a,$01fc,$01e0,$01c5,$01ac,$0194,$017d
  408.     dc.w $0168,$0153,$0140,$012e,$011d,$010d,$00fe,$00f0
  409.     dc.w $00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097
  410.     dc.w $008f,$0087,$007f,$0078,$0071,$0000,$0000,$0000
  411.  
  412. mt_data:    blk.b    0,0
  413.